2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "ESPurpleICQAccountViewController.h"
18 #import "ESPurpleICQAccount.h"
19 #import <Adium/AIAccount.h>
20 #import <AIUtilities/AIPopUpButtonAdditions.h>
21 #import <AIUtilities/AIMenuAdditions.h>
23 @interface ESPurpleICQAccountViewController (PRIVATE)
24 - (NSMenu *)encodingMenu;
25 - (void)addEncodingItemsWithNames:(NSArray *)inArray withTitle:(NSString *)inTitle toMenu:(NSMenu *)menu;
28 @implementation ESPurpleICQAccountViewController
30 - (NSString *)nibName{
31 return @"ESPurpleICQAccountView";
39 [popUp_encoding setMenu:[self encodingMenu]];
43 - (void)configureForAccount:(AIAccount *)inAccount
45 [super configureForAccount:inAccount];
46 [popUp_encoding selectItemWithRepresentedObject:[account preferenceForKey:KEY_ICQ_ENCODING
47 group:GROUP_ACCOUNT_STATUS]];
51 - (void)saveConfiguration
53 [super saveConfiguration];
54 [account setPreference:[[popUp_encoding selectedItem] representedObject]
55 forKey:KEY_ICQ_ENCODING
56 group:GROUP_ACCOUNT_STATUS];
59 - (NSMenu *)encodingMenu
61 NSMenu *menu = [[NSMenu alloc] init];
65 //We'll do custom enabling/disabling and not change it after then, so we don't want auto menuItem validation
66 [menu setAutoenablesItems:NO];
68 title = @"European languages";
69 nameArray = [NSArray arrayWithObjects:
105 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
107 title = @"Semitic languages";
108 nameArray = [NSArray arrayWithObjects:
117 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
120 nameArray = [NSArray arrayWithObjects:
128 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
131 nameArray = [NSArray arrayWithObjects:
143 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
146 nameArray = [NSArray arrayWithObjects:
152 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
155 nameArray = [NSArray arrayWithObjects:
158 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
161 nameArray = [NSArray arrayWithObjects:
165 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
168 nameArray = [NSArray arrayWithObjects:
171 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
174 nameArray = [NSArray arrayWithObjects:
179 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
182 nameArray = [NSArray arrayWithObjects:
186 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
188 title = @"Vietnamese";
189 nameArray = [NSArray arrayWithObjects:
194 [self addEncodingItemsWithNames:nameArray withTitle:title toMenu:menu];
204 return [menu autorelease];
207 - (void)addEncodingItemsWithNames:(NSArray *)inArray withTitle:(NSString *)inTitle toMenu:(NSMenu *)menu
209 NSEnumerator *enumerator;
211 NSMenuItem *menuItem;
214 menuItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:inTitle
218 [menuItem setEnabled:NO];
219 [menu addItem:menuItem];
221 canIndent = [menuItem respondsToSelector:@selector(setIndentationLevel:)];
223 enumerator = [inArray objectEnumerator];
224 while ((name = [enumerator nextObject])) {
225 menuItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:name
229 [menuItem setRepresentedObject:name];
230 if (canIndent) [menuItem setIndentationLevel:1];
232 [menu addItem:menuItem];